package com.dc.designPattern._11_proxy.impl._3_cglib;

/**
 * Description: 代理模式_Cglib动态代理_客户端
 * @author: gdc
 * @date: 2021/4/17
 * @version 1.0
 */
public class Client {

    public static void main(String[] args){
        // step 1 创建被代理对象
        TeacherDao teacherDao = new TeacherDao();

        // step 2 获取代理对象，并将目标对象传递给代理对象
        TeacherDao proxyTeacher = (TeacherDao) new ProxyFactory(teacherDao).getProxyInstatce();

        // step 3 执行代理对象方法，触发 intecept 方法，从而实现对目标对象的调用
        String teach = proxyTeacher.teach();

        // 打印返回结果
        System.out.println("获取返回信息：" + teach);
    }
}
